using System;
using System.Windows.Input;
using WpfWordsLearner.Helper;
using System.Collections.Generic;

namespace WpfWordsLearner.ViewModels
{
	public class Windows1ViewModel : BaseViewModel
	{
		private List<Model.WordsModel> m_words = new List<Model.WordsModel>();
		public ICommand ClickCommand { get { return new BaseCommand(Click); } }

		public Windows1ViewModel()
		{
			m_words = WordsManager.Instance.GetWordsList();
		}

		private void Click()
		{
			Views.AddWordsView add = new Views.AddWordsView();
			if (add.ShowDialog() == true)
			{
				Words = WordsManager.Instance.GetWordsList();
			}
		}

		public ICommand ExitCommand { get { return new BaseCommand(Click2); } }
		private void Click2()
		{
			App.Current.Shutdown();
		}

		public ICommand AddWordRangeCommand { get { return new BaseCommand(Click3); } }
		private void Click3()
		{
			Views.AddWordsRangeView addRange = new Views.AddWordsRangeView();
			if (addRange.ShowDialog() == true)
			{
				Words = WordsManager.Instance.GetWordsList();
			}
		}

		public ICommand BeginTetsCommand { get { return new BaseCommand(Click4); } }
		private void Click4()
		{
			//ViewModels.TestViewModel testVM = new TestViewModel();
			Views.TestView test = new Views.TestView();
			//test.MainLayout.DataContext = testVM;
			test.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
			test.ShowInTaskbar = false;
			test.Topmost = true;
			test.Show();
		}


		public List<WpfWordsLearner.Model.WordsModel> Words
		{
			get { return m_words; }
			set
			{
				m_words = value;
				OnPropertyChanged(() => Words);
			}
		}
	}
}